#ifndef HEARTS_H
#define HEARTS_H

#include "Sprite.h"
#include "Platform.h"
#include "Stair.h"
#include "Step.h"
#include "PlatformHolder.h"
#include "FrameRangeAnimation.h"
#include "FrameRangeAnimator.h"
#include "TimerTickAnimator.h"
#include "FlashingAnimation.h"
#include "FlashingAnimator.h"
#include "TrophyDisplay.h"
#include "Timer.h"

class Hearts : public Sprite {
private:
	typedef std::pair<Sprite*, bool *> AnimatorData;
	FrameRangeAnimation *fallAnimation;
	FrameRangeAnimator *fallAnimator;
	FlashingAnimation *flashAnimation;
	FlashingAnimator *flashAnimator;
	int points;
	int id;
	bool isFlashing;
	bool taken;
	bool broken;
	unsigned int callbacks;
	TrophyDisplay *trophyDisplay;
	time_t lastTime;
	static void HeartBreaks(Animator *, void *closure);
public:
	Hearts(Dim _x, Dim _y, AnimationFilm* film, animid_t id, 
		FrameRangeAnimation *_fallAnimation, FrameRangeAnimator *_fallAnimator, 
		FlashingAnimation *_flashAnimation, FlashingAnimator *_flashAnimator,
		TrophyDisplay *_tdsiplay);
	~Hearts(void);
	bool Flashes(void);
	void StartFalling(void);
	void StopFalling(void);
	void StartFlashing(void);
	void StopFlashing(void);
	int GivePoints(void);
	bool isBroken(void) { return broken; };
	void Break(void) { broken = true; };
	virtual void ResetToDefaultFilm(void);
	virtual void Move(int dx, int dy);
	virtual void CollisionAction(Sprite *s);
	void Pause(timestamp_t currtime);
	void Resume(void);
};

#endif
